package com.ktjy.ulits;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页的类
 */
public class Page<T> {
    private int currentPageNo = 1;//页码
    private int pageSize = 5;//每页显示多少条
    private int totalCount;//总记录数
    private int totalPageCount;//总页数 靠算 总记录数
    private List<T> list = new ArrayList<>();


    public int getCurrentPageNo() {
        return currentPageNo;
    }

    public void setCurrentPageNo(int currentPageNo) {
        this.currentPageNo = currentPageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
        if (this.totalCount > 0) {
            totalPageCount = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
        }
    }

    public int getTotalPageCount() {
        return totalPageCount;
    }


    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
